Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tracing) Change the return type of the native execute #2279

Merged
merged 6 commits into from
Dec 16, 2021

Conversation

evanh
Copy link
Member

@evanh evanh commented Dec 14, 2021

It is very difficult to capture new data from Clickhouse with the current return
value from the function. The current wrapper around the clickhouse-driver
library returns a simple list of results, that gets overloaded with column types
when that meta information is returned. Change the return type to be an object,
so that any data that we might want to propagate up from Clickhouse becomes easy
to add without having to go through this process again.

It is very difficult to capture new data from Clickhouse with the current return
value from the function. The current wrapper around the clickhouse-driver
library returns a simple list of results, that gets overloaded with column types
when that meta information is returned. Change the return type to be an object,
so that any data that we might want to propogate up from Clickhouse becomes easy
to add without having to go through this process again.
@evanh evanh requested a review from a team as a code owner December 14, 2021 19:40
Comment on lines 274 to 309
new_result = {"data": data, "meta": meta}
new_result = {"data": data, "meta": meta, "profile": profile}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean our API is returning "profile" information now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the data is there, just not being used yet. I am going to make use of it in separate PR(s).

class ClickhouseResult:
results: Sequence[Any] = field(default_factory=list)
meta: Sequence[Any] | None = None
profile: Mapping[str, Any] | None = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we provide something more specific ?
Like having a datclass for the profile information. I am not sure what we gain from leaving it as a free form mapping knowing that the profile information is static and well known.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the profiling data from this PR, it's not really this is about. I'll add it back in a separate PR.

@codecov-commenter
Copy link

codecov-commenter commented Dec 15, 2021

Codecov Report

Merging #2279 (39ce5d6) into master (b88c2e1) will increase coverage by 0.00%.
The diff coverage is 89.79%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2279   +/-   ##
=======================================
  Coverage   93.06%   93.06%           
=======================================
  Files         553      553           
  Lines       25238    25255   +17     
=======================================
+ Hits        23487    23503   +16     
- Misses       1751     1752    +1     
Impacted Files Coverage Δ
snuba/clusters/cluster.py 94.87% <ø> (ø)
snuba/migrations/connect.py 34.48% <0.00%> (ø)
snuba/migrations/parse_schema.py 100.00% <ø> (ø)
snuba/migrations/runner.py 91.66% <ø> (ø)
...ts/0010_groupedmessages_onpremise_compatibility.py 100.00% <ø> (ø)
...ns/snuba_migrations/events/0014_backfill_errors.py 96.29% <ø> (ø)
snuba/snapshots/loaders/single_table.py 26.92% <0.00%> (ø)
snuba/web/views.py 67.27% <0.00%> (ø)
tests/datasets/cdc/test_groupassignee.py 100.00% <ø> (ø)
tests/datasets/cdc/test_groupedmessage.py 100.00% <ø> (ø)
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b88c2e1...39ce5d6. Read the comment docs.

@evanh evanh merged commit ffb1de5 into master Dec 16, 2021
@evanh evanh deleted the evanh/feat/return-result-object-from-clickhouse branch December 16, 2021 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants